package com.pingan.agentbank.aaos.service;
/**
 * Title:
 * Description:Generate by isql(lianght).
 * @Copyright: Copyright (c) 2008
 * @Company: CORSWORK
 * @author: lianght
 * @version: 1.0.0
 * @time: Mon Dec 24 15:04:31 CST 2018
 * 
 * Create by isql command:
 * file appro_abnormal com.pingan.agentbank.aaos.service.ApproAbnormal
 */

import com.pingan.agentbank.aaos.dao.ApproAbnormalDao;
import com.pingan.agentbank.aaos.pojo.ApproAbnormalInfo;
import com.pingan.vframe.db.*;
import com.pingan.agentbank.aaos.service.*;
import java.util.*;
import com.pingan.vframe.lang.*;
import com.pingan.vframe.util.*;
/**
 * Class description:ApproAbnormalDaoService
 * 
 * @author 
 */
public class ApproAbnormalDaoService {
	@Inject
	ApproAbnormalDao dao;

	public ApproAbnormalInfo getApproAbnormalInfoByKey(int id) {
		return dao.get(id);
	}

	public int saveOneApproAbnormalInfo(ApproAbnormalInfo info) {
		boolean hasInDB = dao.get(info) != null;
		int count = 0;
		if(hasInDB) {
			count = dao.update(info);
		} else {
			count = dao.insert(info);
		}
		return count;
	}

	public int countAllApproAbnormalInfo() {
		return dao.countAll();
	}

	public List<ApproAbnormalInfo> pageApproAbnormalInfos(int offset, int size) {
		return dao.pageApproAbnormalInfos(offset, size);
	}

	public int deleteOneApproAbnormalInfo(int id) {
		return dao.delete(id);
	}

	public int deleteApproAbnormalInfos(String pks) {
		int count = 0;
		if (pks != null) {
			String[] arr_codes = pks.split(",");
			for (String code:arr_codes) {
				count += dao.delete(code);
			}
		}
		return count;
	}

}
